﻿Imports Control_Vuelos_BL
Imports Control_Vuelos_BE
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Imports DevExpress.XtraBars.Ribbon
Imports System.Reflection
Imports DevExpress.XtraBars.Ribbon.Handler
Imports DevExpress.XtraBars.Ribbon.ViewInfo
Imports DevExpress.Utils

Public Class frmAdm_Manifiesto
    Inherits frmBaseMantenimiento
    Private ReadOnly _V_Reservas As New V_ReservaBL()
    Private ReadOnly _Manifiesto As New ManifiestoBL()
    Private ReadOnly _ProgramaViaje As New ProgramaViajeBL()
    Private p_CodViaje As String
    Private p_CodLugarOrigen As String
    Private p_CodLugarDestino As String
    Private p_CodEmpresa As String
    Private ReadOnly p_Contacto As String
    Private ReadOnly p_EstadoManifiesto As String
    Private p_FchViaje As Date
    Private p_FlgValija As Boolean
    Private p_HraViaje As String
    Private p_NomAeropuerto As String
    Private p_ObsCabeceraManifiesto As String
    Private p_DesLugarOrigen As String
    Private p_DesLugarDestino As String
    Private p_NomEmpresa As String

    Private Sub frmAdm_Manifiesto_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        SG_Control_Vuelos_Main.RibbonPageGroup1.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup2.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup3.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup4.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup5.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup6.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup7.Visible = True
        SG_Control_Vuelos_Main.RibbonPageGroup9.Visible = True
    End Sub

    Private Sub frmAdm_Manifiesto_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AddHandler ModAdm_Manifiesto1.TreeList1.FocusedNodeChanged, AddressOf pr_Select_Tree
        AddHandler ModAdm_Manifiesto1.TreeList2.FocusedNodeChanged, AddressOf pr_Select_TreeCerrado
        AddHandler ModAdm_Manifiesto1.BarButtonItem1.ItemClick, AddressOf pr_Button_Lock
        AddHandler ModAdm_Manifiesto1.BarManager1.ItemClick, AddressOf pr_Button_Responsable
        AddHandler ModAdm_Manifiesto1.BarButtonItem3.ItemClick, AddressOf pr_Button_Buscar
        AddHandler ModAdm_Manifiesto1.BarButtonItem4.ItemClick, AddressOf pr_Button_Masdatos
        AddHandler ModAdm_Manifiesto1.BarButtonItem5.ItemClick, AddressOf pr_Button_Valija
        AddHandler ModAdm_Manifiesto1.BarButtonItem6.ItemClick, AddressOf pr_Button_ValijaImpresion
        AddHandler ModAdm_Manifiesto1.BtnCerradoParcial.ItemClick, AddressOf pr_Button_Cerrado
        AddHandler ModAdm_Manifiesto1.BtnAdjunto.ItemClick, AddressOf pr_Button_Adjunto

        AddHandler BarBtnImprimir.ItemClick, AddressOf pr_Imprimir
        AddHandler BarBtnRefresh.ItemClick, AddressOf pr_Refresh
        ModAdm_Manifiesto1.TreeList1.DataSource = _ProgramaViaje.ListarProgramaViajeTreeList("1")
        ModAdm_Manifiesto1.TreeList1.ExpandAll()
        ModAdm_Manifiesto1.TreeList1.BestFitColumns()
        SetUpGrid(ModAdm_Manifiesto1.GridControl1)
        SetUpGrid(ModAdm_Manifiesto1.GridControl2)
        SetUpGrid(ModAdm_Manifiesto1.GridControl3)
        SetUpGrid(ModAdm_Manifiesto1.GridControl4)
        ModAdm_Manifiesto1.GridControl1.DataSource = _Manifiesto.ListarManifiesto("")
        ModAdm_Manifiesto1.BarButtonItem4.Enabled = True
        ModAdm_Manifiesto1.GridView1.BestFitColumns()
        ModAdm_Manifiesto1.GridView2.BestFitColumns()
        ModAdm_Manifiesto1.GridView3.BestFitColumns()
        ModAdm_Manifiesto1.GridView4.BestFitColumns()

        ModAdm_Manifiesto1.TreeList2.DataSource = _ProgramaViaje.ListarProgramaViajeTreeListCerrado("1")
        ModAdm_Manifiesto1.TreeList2.ExpandAll()
        ModAdm_Manifiesto1.TreeList2.BestFitColumns()


    End Sub

    Public Sub pr_Refresh()
        If p_CodLugarOrigen <> "" Then
            ModAdm_Manifiesto1.GridControl2.DataSource = _V_Reservas.ListarReservas("1", "2", p_CodLugarOrigen)
            ModAdm_Manifiesto1.GridControl3.DataSource = _V_Reservas.ListarReservasVarios("3", "2", p_CodLugarOrigen)
            ModAdm_Manifiesto1.GridControl4.DataSource = _V_Reservas.ListarReservasVarios("2", "2", p_CodLugarOrigen)
        End If
    End Sub

    Public Sub pr_Button_Cerrado()
        If DevExpress.XtraEditors.XtraMessageBox.Show(" Desea cerrar el manifiesto de manera parcial ?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = System.Windows.Forms.DialogResult.Yes Then
            If _Manifiesto.pr_ActualizarEstado(p_CodViaje, "1") Then
                MsgBox(" Manifiesto cerrado satisfactoriamente ", MsgBoxStyle.Information, Text)
                ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
            End If
        End If
    End Sub

    Public Sub pr_Button_Adjunto()
        Dim sfrmAdjuntos As New frmAdm_ManifiestoAdjunto
        sfrmAdjuntos.Text = "Archivos Adjuntos : " & p_CodViaje
        sfrmAdjuntos.p_Codviaje = p_CodViaje
        sfrmAdjuntos.ShowDialog(Me)
    End Sub

    Public Sub pr_Imprimir()
        Dim RptManifiesto As New XRptManifiesto
        RptManifiesto.TituloReporte.Text = String.Format("{0} {1}", RptManifiesto.TituloReporte.Text, Format(p_FchViaje, "dd/MM/yyyy"))
        RptManifiesto.DataSource = _Manifiesto.pr_RecuperarListaManifiestoImpresion(p_CodViaje)
        RptManifiesto.DataMember = "Manifiesto"
        RptManifiesto.ShowRibbonPreviewDialog()
    End Sub

    Public Sub pr_Button_Masdatos()
        Dim sfrmMasDatos As New frmAdm_ManifiestoDatos() With {.Text = "Datos Adicionales...",
                                                             .p_CodViaje = p_CodViaje,
                                                             .Width = ModAdm_Manifiesto1.GridControl1.Width,
                                                             .Height = ModAdm_Manifiesto1.GridControl1.Height}
        sfrmMasDatos.ShowDialog(Me)
    End Sub
    Public Sub pr_Button_Buscar()
        Dim sfrmBuscar As New frmAdm_ManifiestoBuscar() With {.Text = " Buscar Pasajeros "}
        sfrmBuscar.ShowDialog(Me)
    End Sub

    Public Sub pr_Button_Valija()
        Dim _ManifiestoC As New C_ManifiestoBE
        Dim _ManifiestoL As New ManifiestoBL
        _ManifiestoC = _ManifiestoL.pr_RecuperarCabecera(p_CodViaje)

        Dim sfrmValija As New frmAdm_Valija() With {.p_CodViaje = p_CodViaje, .p_FchViaje = p_FchViaje, .p_NroValija = _ManifiestoC.NroValija}
        sfrmValija.ShowDialog(Me)
    End Sub

    Public Sub pr_Button_ValijaImpresion()
        Dim _Valija As New v_ValijaBL
        Dim RptValija As New XRptValija
        RptValija.lbRuta.Text = String.Format("{0} - {1}", p_DesLugarOrigen, p_DesLugarDestino)
        RptValija.lbFecha.Text = p_FchViaje
        RptValija.lbNomEmpresa.Text = p_NomEmpresa
        RptValija.DataSource = _Valija.ListarValijasImpresion(p_CodViaje)
        RptValija.DataMember = "Valija"
        RptValija.ShowRibbonPreviewDialog()
    End Sub

    Public Sub pr_Button_Responsable()
        If ModAdm_Manifiesto1.GridView1.RowCount > 0 Then
            Dim s_Manifiesto As New ManifiestoBL
            Dim row As DataRow = TryCast(ModAdm_Manifiesto1.GridView1.GetDataRow(ModAdm_Manifiesto1.GridView1.GetSelectedRows()(0)), DataRow)
            If Not row Is Nothing Then
                If s_Manifiesto.pr_UpdateDetalleManifiestoResponsable(p_CodViaje, row("CodReserva"), row("FlgResponsable")) Then

                End If
            End If
        End If
    End Sub

    Public Sub pr_Button_Lock()
        If ModAdm_Manifiesto1.GridView1.RowCount > 0 Then
            Dim s_Manifiesto As New ManifiestoBL
            Dim row As DataRow = TryCast(ModAdm_Manifiesto1.GridView1.GetDataRow(ModAdm_Manifiesto1.GridView1.GetSelectedRows()(0)), DataRow)
            If Not row Is Nothing Then
                If s_Manifiesto.pr_UpdateDetalleManifiestoLock(p_CodViaje, row("CodReserva"), row("FlgLock")) Then

                End If
            End If
        End If
    End Sub

    Public Sub pr_Select_Tree(ByVal sender As System.Object, ByVal e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs)
        Dim sLugOrigen As String
        sLugOrigen = ""
        If e.Node.ParentNode Is Nothing Then
            ModAdm_Manifiesto1.GridBand1.Caption = "Manifiesto  "
            ModAdm_Manifiesto1.BarSubItem1.Enabled = False
            ModAdm_Manifiesto1.GridControl1.DataSource = Nothing
            ModAdm_Manifiesto1.BarButtonItem4.Enabled = True
            BarBtnImprimir.Enabled = False
            ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
        Else
            ModAdm_Manifiesto1.GridBand1.Caption = String.Format("Manifiesto : {0} -> {1} - {2}  : {3}", e.Node.GetValue(0), sLugOrigen, e.Node.GetValue(1), Format(e.Node.GetValue(3), "dd/MM/yyyy"))
            p_CodViaje = e.Node.GetValue(0)
            p_DesLugarOrigen = e.Node.ParentNode.GetValue(0)
            p_DesLugarDestino = e.Node.GetValue(1)
            p_FchViaje = e.Node.GetValue(3)
            p_NomEmpresa = e.Node.GetValue(2)
            p_CodEmpresa = e.Node.GetValue(6)
            p_CodLugarOrigen = e.Node.GetValue(7)
            p_CodLugarDestino = e.Node.GetValue(8)
            ModAdm_Manifiesto1.BarSubItem1.Enabled = True
            ModAdm_Manifiesto1.GridControl1.DataSource = _Manifiesto.ListarManifiesto(p_CodViaje)
            If ModAdm_Manifiesto1.GridView1.RowCount > 0 Then
                ModAdm_Manifiesto1.BarButtonItem4.Enabled = True
                BarBtnImprimir.Enabled = True
                ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = True
                Dim CMani As New C_ManifiestoBE
                CMani = _Manifiesto.pr_RecuperarCabecera(p_CodViaje)
                If CMani.EstadoManifiesto = "1" Then
                    ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
                    ModAdm_Manifiesto1.GridBand1.Caption = Trim(ModAdm_Manifiesto1.GridBand1.Caption) & "  (Cerrado Parcial) "
                Else
                    ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = True
                End If
            Else
                ModAdm_Manifiesto1.BarButtonItem4.Enabled = False
                BarBtnImprimir.Enabled = False
                ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
            End If
            ModAdm_Manifiesto1.GridControl2.DataSource = _V_Reservas.ListarReservas("1", "2", p_CodLugarOrigen)
            ModAdm_Manifiesto1.GridControl3.DataSource = _V_Reservas.ListarReservasVarios("3", "2", p_CodLugarOrigen)
            ModAdm_Manifiesto1.GridControl4.DataSource = _V_Reservas.ListarReservasVarios("2", "2", p_CodLugarOrigen)


        End If
    End Sub


    Public Sub pr_Select_TreeCerrado(ByVal sender As System.Object, ByVal e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs)
        Dim sLugOrigen As String
        sLugOrigen = ""
        If e.Node.ParentNode Is Nothing Then
            ModAdm_Manifiesto1.GridBand1.Caption = "Manifiesto  "
            ModAdm_Manifiesto1.BarSubItem1.Enabled = False
            ModAdm_Manifiesto1.GridControl1.DataSource = Nothing
            ModAdm_Manifiesto1.BarButtonItem4.Enabled = True
            BarBtnImprimir.Enabled = False
            ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
        Else
            ModAdm_Manifiesto1.GridBand1.Caption = String.Format("Manifiesto : {0} -> {1} - {2}  : {3}", e.Node.GetValue(0), sLugOrigen, e.Node.GetValue(1), Format(e.Node.GetValue(3), "dd/MM/yyyy"))
            p_CodViaje = e.Node.GetValue(0)
            p_DesLugarOrigen = e.Node.ParentNode.GetValue(0)
            p_DesLugarDestino = e.Node.GetValue(1)
            p_FchViaje = e.Node.GetValue(3)
            p_NomEmpresa = e.Node.GetValue(2)
            p_CodEmpresa = e.Node.GetValue(6)
            p_CodLugarOrigen = e.Node.GetValue(7)
            p_CodLugarDestino = e.Node.GetValue(8)
            ModAdm_Manifiesto1.BarSubItem1.Enabled = True
            ModAdm_Manifiesto1.GridControl1.DataSource = _Manifiesto.ListarManifiesto(p_CodViaje)
            If ModAdm_Manifiesto1.GridView1.RowCount > 0 Then
                ModAdm_Manifiesto1.BarButtonItem4.Enabled = True
                BarBtnImprimir.Enabled = True
                ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = True
                Dim CMani As New C_ManifiestoBE
                CMani = _Manifiesto.pr_RecuperarCabecera(p_CodViaje)
                If CMani.EstadoManifiesto = "2" Then
                    ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
                    ModAdm_Manifiesto1.GridBand1.Caption = Trim(ModAdm_Manifiesto1.GridBand1.Caption) & "  (Cerrado Completo) "
                Else
                    ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = True
                End If
            Else
                ModAdm_Manifiesto1.BarButtonItem4.Enabled = False
                BarBtnImprimir.Enabled = False
                ModAdm_Manifiesto1.BtnCerradoParcial.Enabled = False
            End If
            ModAdm_Manifiesto1.GridControl2.DataSource = _V_Reservas.ListarReservas("1", "2", p_CodLugarOrigen)
            ModAdm_Manifiesto1.GridControl3.DataSource = _V_Reservas.ListarReservasVarios("3", "2", p_CodLugarOrigen)
            ModAdm_Manifiesto1.GridControl4.DataSource = _V_Reservas.ListarReservasVarios("2", "2", p_CodLugarOrigen)
        End If
    End Sub


    Public Sub SetUpGrid(ByVal grid As GridControl)
        grid.AllowDrop = True
        AddHandler grid.DragOver, AddressOf grid_DragOver
        AddHandler grid.DragDrop, AddressOf grid_DragDrop
        Dim view As GridView = TryCast(grid.MainView, GridView)
        view.OptionsBehavior.Editable = False
        AddHandler view.MouseMove, AddressOf view_MouseMove
        AddHandler view.MouseDown, AddressOf view_MouseDown
    End Sub

    Private downHitInfo As GridHitInfo = Nothing

    Private Sub view_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Dim view As GridView = TryCast(sender, GridView)
        downHitInfo = Nothing
        Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
        If Control.ModifierKeys <> Keys.None Then
            Return
        End If
        If e.Button = MouseButtons.Left AndAlso hitInfo.RowHandle >= 0 Then
            downHitInfo = hitInfo
        End If

    End Sub

    Private Sub view_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Dim view As GridView = TryCast(sender, GridView)
        If e.Button = MouseButtons.Left AndAlso downHitInfo IsNot Nothing Then
            Dim dragSize As Size = SystemInformation.DragSize
            Dim dragRect As New Rectangle(New Point(downHitInfo.HitPoint.X - dragSize.Width / 2, downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize)
            If (Not dragRect.Contains(New Point(e.X, e.Y))) Then
                Dim row As DataRow = view.GetDataRow(downHitInfo.RowHandle)
                view.GridControl.DoDragDrop(row, DragDropEffects.Move)
                downHitInfo = Nothing
                DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e).Handled = True
            End If
        End If
    End Sub

    Private Sub grid_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
        Dim grid As GridControl = TryCast(sender, GridControl)
        If e.Data.GetDataPresent(GetType(DataRow)) Then
            e.Effect = DragDropEffects.Move
        Else
            e.Effect = DragDropEffects.None
        End If
    End Sub

    Private Sub grid_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
        Dim grid As GridControl = TryCast(sender, GridControl)
        Dim table As DataTable = TryCast(grid.DataSource, DataTable)
        Dim row As DataRow = TryCast(e.Data.GetData(GetType(DataRow)), DataRow)
        Dim _CMani As New C_ManifiestoBE
        _CMani = _Manifiesto.pr_RecuperarCabecera(p_CodViaje)
        If row IsNot Nothing AndAlso table IsNot Nothing AndAlso row.Table IsNot table Then
            If grid.Tag = "GridEmp" Or grid.Tag = "GridProv" Or grid.Tag = "GridCont" Then
                If _CMani.EstadoManifiesto = "1" Then
                    MsgBox("  Bloqueado por un cierre parcial del manifiesto ", MsgBoxStyle.Critical, Text)
                    Return
                End If

                If _CMani.EstadoManifiesto = "2" Then
                    MsgBox("  Bloqueado por un cierre total del manifiesto ", MsgBoxStyle.Critical, Text)
                    Return
                End If

                If row("FlgLock") = 1 Then
                    MsgBox(" Registro bloqueado ", MsgBoxStyle.Critical, " Lista de Manifiesto")
                    Return
                End If
                If grid.Tag = "GridEmp" Then
                    If row("TipPasajero") <> "1" Then
                        MsgBox(" Reserva solo para Personal Empresa ", MsgBoxStyle.Critical, " Lista de Manifiesto")
                        Return
                    End If
                End If
                If grid.Tag = "GridCont" Then
                    If row("TipPasajero") <> "2" Then
                        MsgBox(" Reserva solo para Contratas ", MsgBoxStyle.Critical, " Lista de Manifiesto")
                        Return
                    End If
                End If
                If grid.Tag = "GridProv" Then
                    If row("TipPasajero") = "1" Then
                        MsgBox(" Reserva solo para Proveedores/Invitados y Terceros ", MsgBoxStyle.Critical, " Lista de Manifiesto")
                        Return
                    End If
                    If row("TipPasajero") = "2" Then
                        MsgBox(" Reserva solo para Proveedores/Invitados y Terceros ", MsgBoxStyle.Critical, " Lista de Manifiesto")
                        Return
                    End If
                End If
                If fn_RemoverPasajero(row) Then
                    table.ImportRow(row)
                    row.Delete()
                End If
            Else
                If _CMani.EstadoManifiesto = "1" Then
                    MsgBox(" No se puede ingresar mas pasajeros por un cierre parcial del manifiesto ", MsgBoxStyle.Critical, Text)
                    Return
                End If
                If _CMani.EstadoManifiesto = "2" Then
                    MsgBox(" No se puede ingresar mas pasajeros por un cierre total del manifiesto ", MsgBoxStyle.Critical, Text)
                    Return
                End If
                If Not ModAdm_Manifiesto1.GetBuscar("NroDocumentoId", row("NroDocumentoId")) Then
                    Return
                End If
                row("FlgLock") = 0
                row("FlgResponsable") = False
                If fn_GrabarPasajero(row) Then
                    table.ImportRow(row)
                    row.Delete()
                End If

            End If
        End If
    End Sub

    Class DragData
        Public sourceData As DataTable
        Public dataRowIndexes As Integer()
        Public Sub New()
            sourceData = Nothing
            dataRowIndexes = Nothing
        End Sub
    End Class

    Private Function GetDragData(ByVal view As GridView) As DragData
        Dim selection() As Integer = view.GetSelectedRows()
        If selection Is Nothing Then
            Return Nothing
        End If
        Dim count As Integer = selection.Length
        Dim result As DragData = New DragData()
        result.sourceData = CType(view.GridControl.DataSource, DataTable)
        result.dataRowIndexes = New Integer(count - 1) {}

        For i As Integer = 0 To count - 1
            result.dataRowIndexes(i) = view.GetDataSourceRowIndex(selection(i))
        Next i
        Return result
    End Function

    Private Function fn_RemoverPasajero(ByVal p_row As DataRow) As Boolean
        Dim s_D_Manifiesto As New D_ManifiestoBE
        Dim s_Manifiesto As New ManifiestoBL
        Try
            s_D_Manifiesto.CodViaje = p_CodViaje
            s_D_Manifiesto.CodReserva = p_row("CodReserva")
            If s_Manifiesto.pr_RemoverPasajeroManifiesto(s_D_Manifiesto) Then
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
            Return False
        End Try
    End Function

    Private Function fn_GrabarPasajero(ByVal p_row As DataRow) As Boolean
        Dim s_C_Manifiesto As New C_ManifiestoBE
        Dim s_D_Manifiesto As New D_ManifiestoBE
        Dim s_Manifiesto As New ManifiestoBL

        Try
            s_C_Manifiesto.CodViaje = p_CodViaje
            s_C_Manifiesto.CodLugarOrigen = p_CodLugarOrigen
            s_C_Manifiesto.CodLugarDestino = p_CodLugarDestino
            s_C_Manifiesto.CodEmpresa = p_CodEmpresa
            s_C_Manifiesto.Contacto = "" ' p_Contacto
            s_C_Manifiesto.EstadoManifiesto = 0 ' p_EstadoManifiesto
            s_C_Manifiesto.FchViaje = p_FchViaje
            s_C_Manifiesto.FlgValija = True  'p_FlgValija
            s_C_Manifiesto.HraViaje = "" ' p_HraViaje
            s_C_Manifiesto.NomAeropuerto = ""  'p_NomAeropuerto
            s_C_Manifiesto.ObsCabeceraManifiesto = "" 'p_ObsCabeceraManifiesto
            s_C_Manifiesto.ObsCabecera = ""
            s_C_Manifiesto.TelContacto = ""

            s_D_Manifiesto.CodViaje = p_CodViaje
            s_D_Manifiesto.CodReserva = p_row("CodReserva")
            s_D_Manifiesto.FlgLock = p_row("FlgLock")
            s_D_Manifiesto.NomPasajero = p_row("NomPasajero")
            s_D_Manifiesto.AppPasajero = p_row("AppPasajero")
            s_D_Manifiesto.ApmPasajero = p_row("ApmPasajero")
            s_D_Manifiesto.NroDocumentoId = p_row("NroDocumentoId")
            s_D_Manifiesto.ObsManifiesto = "" ' p_row("ObsManifiesto")
            s_D_Manifiesto.CodAnalisis = p_row("CodAnalisis")
            s_D_Manifiesto.CodCentroCosto = p_row("CodCentroCosto")
            s_D_Manifiesto.CodCentroCosto2 = p_row("CodCentroCosto2")
            s_D_Manifiesto.FlgResponsable = p_row("FlgResponsable")
            s_D_Manifiesto.NacionalidadPasajero = p_row("NacionalidadPasajero")
            s_D_Manifiesto.PctCentroCosto = p_row("PctCentroCosto")
            s_D_Manifiesto.PctCentroCosto2 = p_row("PctCentroCosto2")
            If s_Manifiesto.pr_AgregarPasajeroManifiesto(s_C_Manifiesto, s_D_Manifiesto) Then
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
            Return False
        End Try
    End Function
End Class


